﻿<?xml version="1.0" encoding="utf-8" ?>

<cls:class
	name="Line"
	type="http://metalx.org/Video/Graphics/Line"
	xmlns="http://metalx.org/Program"
	xmlns:cls="http://metalx.org/Class"
	xmlns:obj="http://metalx.org/i386/Functions/Object"
	xmlns:int="http://metalx.org/i386/Functions/Integer"
	xmlns:vector="http://metalx.org/i386/Functions/Vector2"
	xmlns:float="http://metalx.org/i386/Functions/Float"
	xmlns:lst="http://metalx.org/i386/Functions/List"
	xmlns:str="http://metalx.org/i386/Functions/String"
	xmlns:mm="http://metalx.org/i386/Functions/MemoryManager"
	xmlns:clsf="http://metalx.org/i386/Functions/Class"
	xmlns:var="http://metalx.org/Variable"
	xmlns:sys="http://metalx.org/i386/Functions/System"
	xmlns:cat="http://metalx.org/i386/Functions/Catalog"
	xmlns:ari="http://metalx.org/Intel/80386/Arithmetic"
	xmlns:math="http://metalx.org/Intel/80386/Math"
	xmlns:imm="http://metalx.org/Intel/80386/Immediate"
	xmlns:shift="http://metalx.org/Intel/80386/Shift"
	xmlns:cpu="http://metalx.org/Intel/80386/Operators"
	xmlns:op="http://metalx.org/Intel/80386/Operands"
	xmlns:fpu="http://metalx.org/Intel/80386/FpuOperators">

	<cls:field name="X" type="http://metalx.org/Integer" offset="0"/>
	<cls:field name="Y" type="http://metalx.org/Integer" offset="4"/>
	<cls:field name="Point" type="http://metalx.org/Video/Graphics/Pixel" offset="0"/>
	<cls:field name="Length" type="http://metalx.org/Integer" offset="8"/>

	<cls:method name="Create" type="http://metalx.org/Video/Graphics/Pixel" static="true">
		<cls:parameter name="X" type="http://metalx.org/Integer"/>
		<cls:parameter name="Y" type="http://metalx.org/Integer"/>
		<cls:parameter name="Length" type="http://metalx.org/Integer"/>

		<mm:CheckOut length="12"/>

		<cpu:PushDIToStack/>

		<cpu:CopyOperandToRegister/>
		<op:SI-BPAddressPlusImmediate8/>
		<byte>8</byte>

		<obj:GetData/>

		<cpu:CopySIAddressToDIAddressAndIncrementSIAndDI/>
		
		<cpu:CopyOperandToRegister/>
		<op:SI-BPAddressPlusImmediate8/>
		<byte>4</byte>

		<obj:GetData/>

		<cpu:CopySIAddressToDIAddressAndIncrementSIAndDI/>

		<cpu:CopyOperandToRegister/>
		<op:SI-BPAddressPlusImmediate8/>
		<byte>0</byte>

		<obj:GetData/>

		<cpu:CopySIAddressToDIAddressAndIncrementSIAndDI/>

		<cpu:PullDIFromStack/>
		
		<obj:Create length="12"/>

		<cpu:MathImmediate8ToOperandFunction/>
		<math:AddToBPRegister/>
		<byte>12</byte>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="ToString" type="http://metalx.org/String">
		<cpu:CopyImmediateToDI/>
		<addressOf ref="className" type="Absolute32"/>

		<str:CreateObject/>

		<cpu:ReturnToNearCaller/>

		<var:string id="className">Line</var:string>
	</cls:method>

	<cls:method name="GetClass" type="http://metalx.org/Class">
		<cpu:CopyRegisterToOperand/>
		<op:DI-SIRegister/>

		<obj:GetType/>

		<cpu:CopyRegisterToOperand/>
		<op:SI-DIRegister/>

		<clsf:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>

	<cls:method name="GetClass" type="http://metalx.org/Class" static="true">
		<cpu:CopyRegisterToOperand/>
		<op:BX-DIRegister/>

		<clsf:CreateObject/>

		<cpu:ReturnToNearCaller/>
	</cls:method>
</cls:class>